package com.drop.entity;

import javax.persistence.*;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Comment entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "comment", catalog = "feature_mall")
public class Comment implements java.io.Serializable {

	// Fields

	private Integer commentId;
	private User user;
	private Order order;
	private Goods goods;
	private String content;
	private String commentTime;
	private String commentImg;

	// Constructors

	/** default constructor */
	public Comment() {
	}

	/** full constructor */
	public Comment(User user, Order order, Goods goods, String content, String commentTime,
			String commentImg) {
		this.user = user;
		this.order = order;
		this.goods = goods;
		this.content = content;
		this.commentTime = commentTime;
		this.commentImg = commentImg;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "commentId", unique = true, nullable = false)
	public Integer getCommentId() {
		return this.commentId;
	}

	public void setCommentId(Integer commentId) {
		this.commentId = commentId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "orderId")
	public Order getOrder() {
		return this.order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "goodsId")
	public Goods getGoods() {
		return this.goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Column(name = "content")
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "commentTime", length = 45)
	public String getCommentTime() {
		return this.commentTime;
	}

	public void setCommentTime(String commentTime) {
		this.commentTime = commentTime;
	}

	@Column(name = "commentImg", length = 45)
	public String getCommentImg() {
		return this.commentImg;
	}

	public void setCommentImg(String commentImg) {
		this.commentImg = commentImg;
	}

	@Override
	public String toString() {
		return "Comment{" +
				"commentId=" + commentId +
				", content='" + content + '\'' +
				", commentTime='" + commentTime + '\'' +
				", commentImg='" + commentImg + '\'' +
				'}';
	}
}